package com.myspace.controller.post;

import com.myspace.service.space.post.AddPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class AddPostController {

    @Autowired
    private AddPostService addPostService;

    @PostMapping("/myspace/addpost/")
    public Map<String, String> addpost(@RequestParam Map<String, String> data) {
        Integer userId = Integer.parseInt(data.get("user_id"));
        String content = data.get("content");
        return addPostService.addpost(userId, content);
    }
}
